home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
byte0487.arc
/
TELLO.ARC
/
EXE.LSP
< prev
next >
Wrap
Text File
|
1980-01-01
|
2KB
|
43 lines
(defun show-exe (file)
(setq file (merge-pathnames file ".EXE"))
(with-open-file (stream file :direction :input :element-type 'unsigned-byte)
(format t "~&~%EXE file header of ")
(show-pathname file)
(format t ":~%~%")
(let ((signature (show-dbyte "Link signature" t stream)))
(if (= signature #x5A4D) (format t " (correct)")
(format t " (incorrect)")))
(let ((leftover (show-dbyte "Image length mod 512" nil stream))
(pages (show-dbyte "Image length/512" nil stream)))
(format t "~&Image length: ~D" (+ (* pages 512) leftover)))
(show-dbyte "Relocation table length" nil stream)
(show-dbyte "Header size (paragraphs)" nil stream)
(show-dbyte "Minimum extra memory (paragraphs)" nil stream)
(show-dbyte "Maximum extra memory (paragraphs)" nil stream)
(show-dbyte "Stack segment offset" t stream)
(show-dbyte "Initial SP" t stream)
(show-dbyte "Checksum" t stream)
(show-dbyte "Initial IP" t stream)
(show-dbyte "Code segment offset" t stream)
(show-dbyte "Relocation table offset" nil stream)
(show-dbyte "Overlay number" nil stream)))
(defun show-dbyte (what hex? stream)
(let* ((b1 (read-byte stream))
(b2 (read-byte stream))
(dbyte (logior (ash b2 8) b1)))
(format t "~&~A: " what)
(if hex? (format t "~Xh" dbyte) (format t "~D" dbyte))
dbyte))
(defun show-pathname (pathname)
(format t "~A\\" (pathname-device pathname))
(let ((dirs (pathname-directory pathname)))
(when (listp dirs)
(setq dirs (rest dirs))
(do () ((null dirs))
(format t "~A\\" (first dirs))
(setq dirs (rest dirs))))
(format t "~A" (pathname-name pathname))
(if (pathname-type pathname) (format t ".~A" (pathname-type pathname)))))